package wx.event.utils;

import wx.event.entity.resp.TextMessage;
import wx.event.entity.weixing.WxEventRequest;

/**
 * 回复消息工具类
 */
public class ResponseUtil {
    /**
     * 回复文字消息
     * @param wxEventRequest    微信服务器回复消息
     * @param customMsg         自定义回复文字
     * @return
     */
    public static String respTextMessage(WxEventRequest wxEventRequest, String customMsg){
        TextMessage textMessage = new TextMessage();
        textMessage.setToUserName(wxEventRequest.getFromUserName());
        textMessage.setFromUserName(wxEventRequest.getToUserName());
        textMessage.setCreateTime(System.currentTimeMillis());
        textMessage.setMsgType(MessageUtil.返回消息类型_文本.getType());
        textMessage.setFuncFlag(0);
        textMessage.setContent(customMsg);
        return XMLUtil.textMessageToXml(textMessage);
    }
}
